﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="icon" type="image/gif" href="~/img/animated_favicon1.gif">
    <link href="~/UILibs/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/UILibs/easyui/themes/icon.css" rel="stylesheet" />
    <link href="~/Css/css.css" rel="stylesheet" />

    <script src="~/Scripts/jquery-1.7.1.min.js"></script>
    <script src="~/Scripts/jquery.jqprint-0.3.js"></script>
    <script src="~/UILibs/easyui/jquery.easyui.min.js"></script>

    <script src="~/UILibs/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script src="~/Scripts/datagrid-detailview.js"></script>
    <title></title>
        <style type="text/css">
        .subtotal {
            font-weight: bold;
            color: black;
            /*//background-color: dodgerblue;*/
            height: 200px;
            width: 200px;
            font-size: 20px;
        }

        .subtotal2 {
            font-weight: bold;
            color: black;
            width: 6%;
            margin-top: 10px;
            background-color: orange;
            font-size: 20px;
        }
        /*合计单元格样式*/
    </style>
     <script type="text/javascript">
         $(function () {
            $.ajax({
                 url: " /Recharge/GetMonAll",
                 dataType: "JSON",
                 type: "GET",
                 success: function (data) {                
                     $("#txtSaleMoney").val(data.all + "元");

                 }
             });
         });
     </script>
    <script type="text/javascript">
        $(function () {
            $('#txtName').textbox({
                onChange: function () { searchData() }
            });
            $('#txtDate2').datebox({
                onSelect: function () { searchData() }
            });
            $("#data").datagrid({
                fit: true,
                title: '用户充值信息统计',
                striped: true,
                rownumbers: true,
                columns:        //rechargeId  rechargeDate rechargeValue wechatName userName userPhone
                    [[
                            { field: 'wechatCode', title: '微信名称', width: 180, halign: 'center', align: 'center' ,hidden:true},
                            { field: 'wechatName', title: '微信名称', width: 180, halign: 'center', align: 'center' },
                            { field: 'userName', title: '用户姓名', width: 180, halign: 'center', align: 'center' },
                            { field: 'userPhone', title: '用户手机号', width: 120, halign: 'center', align: 'center', },
                            { field: 'rechargeNum', title: '累计充值次数', width: 180, halign: 'center', align: 'center', sortable: true },
                            { field: 'rechargeAllMoney', title: '累计充值金额', width: 180, halign: 'center', align: 'center', sortable: true },
                             { field: 'balance', title: '余额', width: 180, halign: 'center', align: 'center', sortable: true },
                    ]],
                singleSelect: true,
                loadMsg: '正在加载数据,请耐心等待.......',
                url: pageConfig.getAction,
                queryParams: {
                    adminUsername: $('#txtName').val(),
                    userPhone: $('#txtPhone').val(),
                },
                pagination: true,
                pageSize: 25,
                pageList: [25,30,35],
                sortName: 'rechargeNum',
                sortOrder: 'desc',
                toolbar: '#tool',
            });


            $('#data').datagrid({
                view: detailview,
                detailFormatter: function (index, row) {
                    return '<div style="padding:12px"><table class="ddv"></table></div>';
                },
                onExpandRow: function (index, row) {
                    var ddv = $(this).datagrid('getRowDetail', index).find('table.ddv');
                    ddv.datagrid({
                        url: '/Recharge/GetRechargeDetails',
                        fitColumns: true,
                        singleSelect: true,
                        rownumbers: true,
                        loadMsg: '',
                        height: 'auto',
                        columns: [[
                                 {
                                     field: 'rechargeId',   //rechargeId  rechargeDate rechargeValue wechatName userName userPhone
                                     title: '充值编号',
                                     width: 100,
                                     height: 50,
                                     halign: 'center',
                                     sortable: true,
                                     align: 'center'
                                 }, {
                                     field: 'rechargeValue',
                                     title: '充值金额',
                                     width: 200,
                                     height: 50,
                                     halign: 'center',
                                     align: 'center',
                                 }, {
                                     field: 'rechargeDate',
                                     title: '充值时间',
                                     width: 200,
                                     height: 50,
                                     halign: 'center',
                                     align: 'center',
                                 },

                        ]],
                        onResize: function () {
                            $('#data').datagrid('fixDetailRowHeight', index);
                        },
                        queryParams: {
                            wechatCode: row.wechatCode,
                        }
                    });
                    $('#data').datagrid('fixDetailRowHeight', index);
                }
            });




        });
        var pageConfig = {
            getAction: '@Url.Action("GetChargeNote")',
        };
        function searchData() {
        $("#data").datagrid('load', {
            adminUsername: $("#txtName").val(),
            userPhone: $('#txtPhone').val(),
                  
        });
        }

    </script>   
</head>
<body class="easyui-layout" style="width: 100%; height: 100%">
    <div data-options="region:'center'" id="dataPrint">

        <table id="data" style="height: 50px"></table>

    </div>

    <div id="tool" style="padding: 30px;">
        <div>
            微信姓名：
                    <input id="txtName" type="text" onchange="searchData()" />
            &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp 
            手机号：
                    <input id="txtPhone" type="text" onchange="searchData()" />
            &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp 
               <a class="easyui-linkbutton" iconcls="icon-search" onclick="searchData()">查询</a>
            &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp
             &nbsp&nbsp&nbsp  &nbsp&nbsp&nbsp  &nbsp&nbsp&nbsp <span class="subtotal" style="">充值总金额：</span>
                <input id="txtSaleMoney" type="text" class="subtotal2" />
        </div>

    </div>
    <style>
        #dataPrint.datagrid-btable tr {
            height: 50px;
        }
    </style>
</body>
</html>
